package com.ict.web.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ict.common.utils.DateUtils;
import com.ict.common.utils.bean.BeanUtils;
import com.ict.web.controller.file.dto.YzqFileDTO;
import com.ict.web.domain.Notice;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 公告对象 yzq_notice
 *
 * @author xss
 * @date 2022-02-15
 */
@Data
public class UpdateNoticeDto {
    @ApiModelProperty(value = "公告id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long noticeId;

    @ApiModelProperty(value = "公告标题")
    private String noticeTitle;

    @ApiModelProperty(value = "公告内容")
    private String noticeContent;

    @ApiModelProperty(value = "公告附件")
    private YzqFileDTO noticeFile;

    @ApiModelProperty(value = "公告发送人")
    private String noticeSend;

    public static Notice of(UpdateNoticeDto updateDto){
        Notice bean = new Notice();
        BeanUtils.copyProperties(updateDto,bean);
        //设置更新时间
        bean.setUpdateTime(DateUtils.getNowDate());

        return bean;
    }
}
